package com.icloud.common.database.enums;

import lombok.Getter;

@Getter
public enum BusinessTypeEnum {
    ARTICLE("ARTICLE"),
    DISCUSS("DISCUSS");

    private final String code;

    BusinessTypeEnum(String code){
        this.code = code;
    }

    public static BusinessTypeEnum byCode(String code) {
        for (BusinessTypeEnum e: BusinessTypeEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                return e;
            }
        }
        return null;
    }

    public static boolean isArticle(String code){
        return ARTICLE.getCode().equalsIgnoreCase(code);
    }
    public static boolean isDiscuss(String code){
        return DISCUSS.getCode().equalsIgnoreCase(code);
    }
}
